;
(function() {
	'use strict';
	angular.module('controllers.resourcesWatchData.allInfoDisplay')
		.controller('allInfoDisplayController', allInfoDisplayController);

	function allInfoDisplayController($scope, System, allInfoDisplayService, CoreService) {
		$scope.sysNames = System;
		//控制查询条件拉上拉下   1为拉下  0 为拉上
		$scope.shoumun = {
			num: 1
		};
		$scope.sendData = {
			systemCode: '11',
			regionCode: []
		};

		$scope.params = {
			systemCode: ''
		};
		//控制等待样式   false 为隐藏   true 为显示
		$scope._loading.show = false;
		$scope.$watch('sendData.systemCode', function(code) {
			$scope.params.systemCode = code;
			allInfoDisplayService.getRegion($scope.params, function(res) {
				if (res.state === '10000' && res.data.length >= 1) {
					$scope.regions = res.data;
					$scope.sendData.regionCode = [];
				}
			});
		});

		$scope.search = function() {
			if ($scope.shoumun.num === 1) {
				$scope.shoumun.num = 1;
				return;
			}
			$scope.send = allInfoDisplayService.getfmtSend($scope.sendData, $scope.regions);
			allInfoDisplayService.queryHostNum($scope.send, function(res) {
				if (res.state === '10000' && res.data.length >= 1) {
					$scope.items = res.data;
					$scope.shoumun.num = 0;
					$scope.flag = 'table';
				} else if (res.data.length === 0) {
					$scope.shoumun.num = 1;
					CoreService.dialog('查询无数据');
				} else {
					CoreService.dialog('查询错误');
				}
			});
		};
		// var myEcharts = echarts.init(document.getElementById('doc'));
		// var myEcharts1 = echarts.init(document.getElementById('doc1'));
		// var myEcharts2 = echarts.init(document.getElementById('doc2'));
		// var myEcharts3 = echarts.init(document.getElementById('doc3'));
		// $scope.queryHostInfo = function(item) {
		// 	$scope.param = {
		// 		systemNameParameter: item.systemName,
		// 		regionNameParameter: item.region
		// 	};
		// 	allInfoDisplayService.queryHostInfo($scope.param, function(res) {
		// 		if (res.state === '10000') {
		// 			var a = allInfoDisplayService.getHostInfo(res, 'cpuRate', 'cpu平均使用情况', '使用比率');
		// 			var b = allInfoDisplayService.getHostInfo(res, 'diskRate', '磁盘平均使用情况', '千字节/秒');
		// 			var c = allInfoDisplayService.getHostInfo(res, 'ramRate', '内存平均使用情况', '百分比(%)');
		// 			var d = allInfoDisplayService.getHostInfo(res, 'interRate', '网络平均使用情况', '(k/s)');
		// 			myEcharts.setOption(a);
		// 			myEcharts1.setOption(b);
		// 			myEcharts2.setOption(c);
		// 			myEcharts3.setOption(d);
		// 			$scope.flag = 'view';
		// 		} else if (res.data.length === 0) {
		// 			$scope.shoumun.num = 1;
		// 			CoreService.dialog('查询无数据');
		// 		} else {
		// 			CoreService.dialog('查询无数据');
		// 		}
		// 	});
	};
	// $scope.back = function() {
	// 	$scope.flag = 'table';
	// };
})();